package com.pgybook.front.service.impl;


import com.pgybook.db.entity.domain.*;
import com.pgybook.db.entity.mapper.CityDistrictMapper;
import com.pgybook.db.entity.mapper.CityMapper;
import com.pgybook.db.entity.mapper.ProvinceMapper;
import com.pgybook.front.service.GoeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: feeling
 * Date: 13-11-22
 * Time: 上午12:30
 */
@Service
public class GoeServiceImpl implements GoeService {

    @Override
    public List<City> getCities(Integer provinceId) {
        CityEx ex = new CityEx();
        ex.or().andPrvidEqualTo(provinceId);
        return cityDao.selectByExample(ex);
    }

    @Override
    public List<CityDistrict> getCityDistricts(Integer cityId) {
        CityDistrictEx ex = new CityDistrictEx();
        ex.or().andCityidEqualTo(cityId);
        return cityDistrictDao.selectByExample(ex);
    }

    @Override
    public List<Province> getProvinces() {
        ProvinceEx ex = new ProvinceEx();
        ex.createCriteria();
        return provinceDao.selectByExample(ex);
    }

    @Autowired
    CityMapper cityDao;

    @Autowired
    CityDistrictMapper cityDistrictDao;

    @Autowired
    ProvinceMapper provinceDao;
}
